import { Pipe, PipeTransform } from '@angular/core';
// im聊天-特殊字符转换
@Pipe({
    name: 'escapeFilter',
})
export class EscapefilterPipe implements PipeTransform {
    transform(value: any, args?: any): any {
        if (value === undefined) {
            return;
        }
        let a;
        if (args !== null) {
            if (args === "chat-invite") {
                // "第一条消息tel:<font color=#499DF2 >15112345678</font>"
                value = value
                    .replace("<font color=#499DF2 >", "")
                    .replace("</font>", "");
            }
        }
        // 新增换行符处理
        a = value
            .replace(/&gt;/g, ">")
            .replace(/&lt;/g, "<")
            .replace(/&amp;/g, "&"); // .replace(/\n/g, '<br />');

        return a;
    }
}
